<!--
	作者：2575202388@qq.com
	时间：2018-10-14
	描述：首页我的信息
-->

<template>
    <Card :bordered="false" style="height:430px;">
        <p slot="title">
        	<Icon type="md-pie" style="color:#5d5386;font-size: 18px;"/>	 
        	<span style="padding-left:2px;font-weight: normal;">章节读后感</span>
        </p>
        <div style="width:100%;float:left;text-align: center;margin:0 auto;display:table;" align="center">	
      		<div ref="static5" style="width:100%;min-width: 600px; float:left;height:330px;"></div>
        </div>
    </Card>
</template>

<script>
	import Highcharts from 'highcharts'
	require('highcharts/modules/exporting')(Highcharts);
	export default {
		name:"static5",
		props: {
    		newstatic:{
    			type: Array
    		}
    	},
		mounted(){
			
		},
		methods: {
		     drawLine(){
		     	var newstatic=this.newstatic;
				var one=0;var two=0;
				var three=0;var four=0;
				var five=0;var six=0;
		     	for(var i=0;i<newstatic.length;i++){
					if(newstatic[i].ZJDHG){
						if(newstatic[i].NJ==1){
							one=parseInt(one)+parseInt(newstatic[i].ZJDHG);
						}else if(newstatic[i].NJ==2){
							two=parseInt(two)+parseInt(newstatic[i].ZJDHG);
						}else if(newstatic[i].NJ==3){
							three=parseInt(three)+parseInt(newstatic[i].ZJDHG);
						}else if(newstatic[i].NJ==4){
							four=parseInt(four)+parseInt(newstatic[i].ZJDHG);
						}else if(newstatic[i].NJ==5){
							five=parseInt(five)+parseInt(newstatic[i].ZJDHG);
						}else if(newstatic[i].NJ==6){
							six=parseInt(six)+parseInt(newstatic[i].ZJDHG);
						}
					}
		     	}
		    
		    	var chart = Highcharts.chart(this.$refs.static5, {	
					chart: {
						type: 'pie',
						options3d: {
							enabled: true,
							alpha: 45,
							beta: 0
						}
					},
					title: {
						text: '各年级章节读后感比例'
					},
					tooltip: {
						pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
					},
					plotOptions: {
						pie: {
							allowPointSelect: true,
							cursor: 'pointer',
							depth: 35,
							dataLabels: {
								enabled: true,
								format: '{point.name}'
							}
						}
					},
					series: [{
						type: 'pie',
						name: '各年级章节读后感比例',
						data: [
							['一年级',one],
							['二年级',two],
							['三年级',three],
							['四年级',four],
							['五年级',five],
							['六年级',six],
						]
					}]
				});

		    }
		},
		watch:{
			newstatic(news,olds){
				if(news){
					this.drawLine();
				}
			}
		},
	}
</script>

<style>

</style>



